home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QRZ! Ham Radio 8
/
QRZ Ham Radio Callsign Database - Volume 8.iso
/
mac
/
files
/
arrl
/
biennew.src
< prev
next >
Wrap
Text File
|
1996-06-25
|
12KB
|
453 lines
*68HC705C8 REMOTE DISPLAY
*FOR TS-140 Transceiver, and other Kenwood HF Transceivers
*VERSION 4.3 (MAR. 12, 1993) (SHORTENED DISLET/WCTRL DELAYS...)
*Steven N. Bienvenu, NB5F
*COPYRIGHT 1993; this program may NOT be used for commercial
*purposes or sale, nor altered without express permission of the
*author
* Register Equates
PORTA EQU $00 LCD DATA/CONTROL PORTS
PORTB EQU $01 EQUATES
DDRA EQU $04
DDRB EQU $05
BRATE EQU $0D SCI EQUATES
SCCR1 EQU $0E
SCCR2 EQU $0F
SCSR EQU $10
SCDAT EQU $11
* Ram Equates
TEMPA EQU $51 ONE BYTE TEMPORARY STORAGE
TEMPX EQU $52 ONE BYTE TEMPORARY STORAGE
TEMPM EQU $53 " "
TEMPV EQU $54 " "
VFO EQU $55 VFO DATA BYTE, TEMP. STRG
* RESERVE RECEIVED DATA MEMORY AREAS
ORG $60
RDATA RMB $28 RESERVES 40 BYTES FOR
* INPUT DATA
RDATB RMB $D RESERVES 13 DATA BYTES
ORG $100 BEGINS PROG @ THIS ADDR
* SET PORT DATA BIT PATTERNS AND DIRECTIONS
DDREX LDA #$FF
STA DDRA PORT A ALL OUTPUTS
STA DDRB PORT B ALL OUTPUTS
* INITIALIZE LCD DISPLAY
JSR LCDLY DELAY FOR DISPLAY SETUP
LCDINIT JSR INIT INITIALIZE DISPLAY......
LDA #$00 ASSURES BITS CLEAR
STA VFO FOR LATER TESTING
* INITIALIZE SCI
SCIINIT LDA #%00110000 SET BAUD RATE 4800
STA BRATE ( @ 2 MHZ XTAL)
LDA #%01010000 SET SCCR1 TO 9 BITS
STA SCCR1 (GIVES XTRA STOP BIT)
LDA #%00001100 ENABLE SCI RX/TX
STA SCCR2
* COMMUNICATIONS ROUTINES
CMD1 FCC 'IF;+' "INFO" REQ. COMMAND STRING
CMD2 FCC 'FB;+' VFO "B" FREQ REQ.
CMD3 FCC 'FA;+' VFO "A" FREQ REQ.
GETREDY CLRX
SEND LDA CMD1,X SEND INFO REQUEST
CMP #'+ END OF CMD STRING?
BEQ SETSTRT THEN GET RESPONSE
SENDATA BRCLR 7,SCSR,SENDATA
STA SCDAT
INCX
BRA SEND
SETSTRT CLRX
GETDATA BRCLR 5,SCSR,GETDATA RDRF=1?
LDA SCDAT OK, GET DATA.
CMP #'I CKS FOR PROPER
BEQ GOODATA 1ST CHAR. OF STRG
BRA GETDATA
AGAIN BRCLR 5,SCSR,AGAIN
LDA SCDAT
GOODATA STA RDATA,X
CPX #37
BEQ SWITCH
INCX
BRA AGAIN
SWITCH LDX #32
LDA RDATA,X
CMP #'0
BEQ JUMP
BRCLR 5,VFO,IFEMPTY
JMP CON LOADS VFO BYTE IF
IFEMPTY LDX #30 SPLIT IS ON WHEN
LDA RDATA,X RADIO TURNED ON
STA VFO
CON JMP CONTIN
JUMP JMP DISPLAY
CONTIN LDX #30
LDA RDATA,X
CMP #'0
BEQ FB REQUESTS B IF OP FREQ=A
CLRX
SEND2 LDA CMD3,X REQUESTS "A"
CMP #'+
BEQ BEGIN
SENDATA2 BRCLR 7,SCSR,SENDATA2
STA SCDAT
INCX
BRA SEND2
FB CLRX
SEND3 LDA CMD2,X REQUESTS "B"
CMP #'+
BEQ BEGIN
SENDATA3 BRCLR 7,SCSR,SENDATA3
STA SCDAT
INCX
BRA SEND3
BEGIN CLRX
DATAGET BRCLR 5,SCSR,DATAGET NEW OP FREQ
LDA SCDAT DISP. ROUTINE
STA RDATB,X
CPX #13
BEQ SWAP
INCX
BRA DATAGET
SWAP LDX #30
LDA RDATA,X
CMP VFO
BEQ DISPLAY2 IF VFO UNCHANGED,
LDA #$C5 PRINT SAME LOC LCD;
JSR WCTRL OTHERWISE, SWITCH
JMP BOT LOCATIONS
DISPLAY2 LDA #$85
JSR WCTRL
BOT LDX #5
LDA RDATA,X
CMP #'0
BEQ BLANK
JSR DISLET
LOOP INCX
CPX #10
BEQ LAST
LDA RDATA,X
JSR DISLET
BRA LOOP
BLANK LDA #' '
JSR DISLET
BRA LOOP
LAST LDA #'.
JSR DISLET
LDA RDATA,X
JSR DISLET
LDA #'<
JSR DISLET
LDX #30
LDA RDATA,X
CMP VFO
BEQ DISFB IF VFO NO CHANGE,
LDA #$85 PRINT @ SAME SPOT;
JSR WCTRL OTHERWISE, SWITCH
JMP TOP
DISFB LDA #$C5
JSR WCTRL
TOP LDX #5
LDA RDATB,X
CMP #'0
BEQ BLANK2
JSR DISLET
LOOP2 INCX
CPX #10
BEQ LAST2
LDA RDATB,X
JSR DISLET
BRA LOOP2
BLANK2 LDA #' '
JSR DISLET
BRA LOOP2
LAST2 LDA #'.
JSR DISLET
LDA RDATB,X
JSR DISLET
LDA #' '
JSR DISLET
JMP MODE
*****************************
* SUBROUTINES *
*****************************
DISPLAY LDX #5
PRINT LDA #$85
JSR WCTRL ROUTINE CHECKS FOR
LDA RDATA,X ONE OR TWO-DIGIT
CMP #'0 MHZ, THEN PRINTS
BEQ PRINT2 FREQUENCY
LDA RDATA,X
JSR DISLET
INCX
LDA RDATA,X
JSR DISLET
LDA #'.
JSR DISLET
PRINTLP INCX
CPX #10
BEQ MODE
LDA RDATA,X
JSR DISLET
BRA PRINTLP
PRINT2 LDA #' ' ERASES LEADING ZERO
JSR DISLET
INCX
LDA RDATA,X
JSR DISLET
LDA #'.
JSR DISLET
PRINTLP2 INCX
CPX #10
BEQ MODE
LDA RDATA,X
JSR DISLET
BRA PRINTLP2
MODE LDA #$C0
JSR WCTRL
LDX #29
LDA RDATA,X
CMP #'1 MODE DETECTION
BEQ LSB
CMP #'2 AND DISPLAY
BEQ USB
CMP #'3
BEQ CW
CMP #'4
BEQ FM
CMP #'5
BEQ AM
CMP #'7
BEQ CWN
LSB LDA #'L
JSR DISLET
LDA #'S
JSR DISLET
LDA #'B
JSR DISLET
JMP RIT
USB LDA #'U
JSR DISLET
LDA #'S
JSR DISLET
LDA #'B
JSR DISLET
JMP RIT
CW LDA #'C
JSR DISLET
LDA #'W
JSR DISLET
LDA #' '
JSR DISLET
JMP RIT
FM LDA #'F
JSR DISLET
LDA #'M
JSR DISLET
LDA #' '
JSR DISLET
JMP RIT
AM LDA #'A
JSR DISLET
LDA #'M
JSR DISLET
LDA #' '
JSR DISLET
JMP RIT
CWN LDA #'C
JSR DISLET
LDA #'W
JSR DISLET
LDA #'N
JSR DISLET
JMP RIT
RIT LDA #$8D DISPLAYS "RIT" IF ON
JSR WCTRL
LDX #23
LDA RDATA,X
CMP #'0
BEQ RETPROG TO RETURN TO MAIN STREAM
LDA #'R AND TURN OFF RIT DISPLAY
JSR DISLET
LDA #'I
JSR DISLET
LDA #'T
JSR DISLET
JMP SPLIT
RETPROG LDA #' ' TURNS OFF RIT DISPLAY
JSR DISLET
LDA #' '
JSR DISLET
LDA #' '
JSR DISLET
SPLIT LDA #$80
JSR WCTRL
LDX #32
LDA RDATA,X
CMP #'0
BEQ SPLITOFF
LDA #'S
JSR DISLET
LDA #'P
JSR DISLET
LDA #'L
JSR DISLET
LDA #'T
JSR DISLET
JMP GETREDY
SPLITOFF LDA #' ' TURNS IT OFF
JSR DISLET
LDA #' '
JSR DISLET
LDA #' '
JSR DISLET
LDA #' '
JSR DISLET
LDA #$C5
JSR WCTRL
LDX #8
BLANKSPLT LDA #' '
JSR DISLET
DECX
BNE BLANKSPLT
LDA #$8B
JSR WCTRL
LDA #' '
JSR DISLET
LDA #' '
JSR DISLET
LDX #30 LOADS VFO BYTE
LDA RDATA,X
STA VFO
JMP GETREDY
WCTRL STX TEMPX SAVE X
STA PORTB WRITE CONTROL WORD TO BUS
BCLR 1,PORTA SET R/W TO WRITE
BCLR 2,PORTA SET RS TO CONTROL
BSET 0,PORTA ENABLE ON
BCLR 0,PORTA ENABLE OFF
LDX #$07 ]
DELAY2 DECX ] DELAY
BNE DELAY2 ] FOR
CMP #$02 ] CONTROL
BHI DELAY4 ] (42uS)
DELAY3 DECX XTRA DELAY, FOR CMDS 1&2
BNE DELAY3 (1.644 mS)
LDX #$12
MORE DECX
BNE MORE
DELAY4 LDX TEMPX RESTORE INDEX REGISTER
ENDCTRL RTS RETURN FROM SUBROUTINE
DISLET STX TEMPX SAVE INDEX REGISTER
STA PORTB PUT CHARACTER ON BUS
BCLR 1,PORTA SET R/W TO WRITE
BSET 2,PORTA SET RS TO DATA
BSET 0,PORTA TURN ON ENABLE
BCLR 0,PORTA ENABLE OFF
LDX #$07 ] DELAY 42 uS
DELAY1 DECX ] ASSUMING 1 uS
BNE DELAY1 ] CLOCK
LDX TEMPX RESTORE INDEX REGISTER
RTS RETURN FROM SUBROUTINE
INIT LDA #$38 SET 8-BIT, 2-LN, 5X7
JSR WCTRL
LDA #$1 CLEAR DSPLY, ADR CNTR
JSR WCTRL TO ZERO
LDA #$C DSPLY ON, CSR OFF
JSR WCTRL
LDA #$6 ENTRY MODE, SHIFTS CSR
JSR WCTRL TO RIGHT ON WRITES
RTS RETURN FROM SUBROUTINE
DLY50 STA TEMPA |
LDA #32 |
OUTRLP CLRX |
INLP DECX |
BNE INLP |
DECA |
BNE OUTRLP |
LDA TEMPA |
RTS
LCDLY STX TEMPX SAVE X
LDA #15 : (DELAY UNTIL LCD READY)
OUTLP CLRX : X USED AS INNER LOOP
INNERLP DECX : COUNTER...
BNE INNERLP : 6CYC*256*1uS=1.536ms
DECA
BNE OUTLP : 15*1.536ms=23.04ms DLY
LDX TEMPX RESTORE X
RTS RETURN FROM SUBROUTINE
ORG $1FFE PROVIDING RESET VECTOR
FDB DDREX WITH THESE TWO LINES...